Data_wrangling_on_progress_towards_SDG7

By Hafsah Anibaba

Data on indicators of SDG goals for all countries

This data was retrieved from the worldbank website through this link
The data has trend on the indicators of SDGs for all countries from year 1960 to 2021

Target 7.1: By 2030, ensure universal access to affordable, reliable and modern energy services

relevant indicator is Access to electricity (% of population)

From 1960 to 1989 and in 2021, no data was collected on access to electricity for all countries so I will remove those years from the data

In [10]:
#check if there is duplicate i.e a country appearing twice

print(f'number of duplicate observation is {access.duplicated().sum()}')
number of duplicate observation is 0
In [14]:
countries = null_counts.index
countries_with_no_record((25, 9), countries, null_counts, 'countries with their number of years of\n\
    no records')
In [15]:
null_counts_highest = null_counts[null_counts > 10]
countries_high = null_counts_highest.index
countries_with_no_record((12, 9), countries_high, null_counts_highest, 'countries that had\
more than 10 years of no record')
In [17]:
countries_10 = null_counts[null_counts == 10].index.to_list()
plt.rcParams["animation.html"] = "jshtml"
animate_the_countries(countries_10, 'Countries with no records for 10 years', True, 'missing 10 years')
Out[17]:
In [18]:
non_null_counts = access_country.T.isna().sum()[access_country.T.isna().sum() == 0].sort_values()
full = non_null_counts.index.to_list()
plt.rcParams["animation.html"] = "jshtml"
animate_the_countries(full, 'Countries with records for all years', False, 'no missing years')
Out[18]:
In [19]:
miss = null_counts.index.to_list()
plt.rcParams["animation.html"] = "jshtml"
animate_the_countries(miss, 'Countries with at least one missing record', False, 'missing at least a year')
Out[19]:

it seems Not classified countries and American Samoa has no record at all

In [ ]: